/*     */ package com.umeng.newxp.view.widget;
/*     */ 
/*     */ import android.content.Context;
/*     */ import android.content.res.Resources;
/*     */ import android.graphics.Paint;
/*     */ import android.graphics.drawable.Drawable;
/*     */ import android.graphics.drawable.ShapeDrawable;
/*     */ import android.graphics.drawable.shapes.OvalShape;
/*     */ import android.graphics.drawable.shapes.Shape;
/*     */ import android.util.AttributeSet;
/*     */ import android.util.DisplayMetrics;
/*     */ import android.widget.ImageView;
/*     */ import android.widget.LinearLayout;
/*     */ import android.widget.LinearLayout.LayoutParams;
/*     */ import com.umeng.common.Log;
/*     */ import java.util.ArrayList;
/*     */ 
/*     */ public class SwipeViewPointer extends LinearLayout
/*     */ {
/*  41 */   private int a = 7;
/*     */   private Drawable b;
/*     */   private Drawable c;
/*     */   private ArrayList<ImageView> d;
/*  48 */   private int e = 0;
/*  49 */   private int f = 0;
/*     */   private Context g;
/*  52 */   private a h = null;
/*     */ 
/*     */   public SwipeViewPointer(Context paramContext) {
/*  55 */     super(paramContext);
/*  56 */     this.g = paramContext;
/*  57 */     a();
/*     */   }
/*     */ 
/*     */   public SwipeViewPointer(Context paramContext, AttributeSet paramAttributeSet) {
/*  61 */     super(paramContext, paramAttributeSet);
/*  62 */     this.g = paramContext;
/*     */   }
/*     */ 
/*     */   protected void onFinishInflate()
/*     */   {
/*  68 */     a();
/*     */   }
/*     */ 
/*     */   private void a() {
/*  72 */     Log.a("uk.co.jasonfry.android.tools.ui.PageControl", "Initialising PageControl");
/*     */ 
/*  74 */     this.d = new ArrayList();
/*     */ 
/*  76 */     this.b = new ShapeDrawable();
/*  77 */     this.c = new ShapeDrawable();
/*     */ 
/*  79 */     this.b.setBounds(0, 0, this.a, this.a);
/*  80 */     this.c.setBounds(0, 0, this.a, this.a);
/*     */ 
/*  82 */     OvalShape localOvalShape1 = new OvalShape();
/*  83 */     localOvalShape1.resize(this.a, this.a);
/*     */ 
/*  85 */     OvalShape localOvalShape2 = new OvalShape();
/*  86 */     localOvalShape2.resize(this.a, this.a);
/*     */ 
/*  88 */     ((ShapeDrawable)this.b).getPaint().setColor(-12303292);
/*  89 */     ((ShapeDrawable)this.c).getPaint().setColor(-3355444);
/*     */ 
/*  91 */     ((ShapeDrawable)this.b).setShape(localOvalShape1);
/*  92 */     ((ShapeDrawable)this.c).setShape(localOvalShape2);
/*     */ 
/*  94 */     this.a = ((int)(this.a * getResources().getDisplayMetrics().density));
/*     */ 
/*  96 */     setOnTouchListener(new c(this));
/*     */   }
/*     */ 
/*     */   public void setActiveDrawable(Drawable paramDrawable)
/*     */   {
/* 143 */     this.b = paramDrawable;
/*     */ 
/* 145 */     if ((this.d != null) && (this.d.size() > 0)) ((ImageView)this.d.get(this.f))
/* 146 */         .setBackgroundDrawable(this.b);
/*     */   }
/*     */ 
/*     */   public Drawable getActiveDrawable()
/*     */   {
/* 155 */     return this.b;
/*     */   }
/*     */ 
/*     */   public void setInactiveDrawable(Drawable paramDrawable)
/*     */   {
/* 165 */     this.c = paramDrawable;
/*     */ 
/* 167 */     if ((this.d != null) && (this.d.size() > 0)) {
/* 168 */       for (int i = 0; i < this.e; i++) {
/* 169 */         ((ImageView)this.d.get(i)).setBackgroundDrawable(this.c);
/*     */       }
/*     */ 
/* 172 */       ((ImageView)this.d.get(this.f)).setBackgroundDrawable(this.b);
/*     */     }
/*     */   }
/*     */ 
/*     */   public Drawable getInactiveDrawable()
/*     */   {
/* 183 */     return this.c;
/*     */   }
/*     */ 
/*     */   public void setPageCount(int paramInt)
/*     */   {
/* 193 */     this.e = paramInt;
/* 194 */     for (int i = 0; i < paramInt; i++)
/* 195 */       b();
/*     */   }
/*     */ 
/*     */   private void b()
/*     */   {
/* 200 */     ImageView localImageView = new ImageView(this.g);
/* 201 */     LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(this.a, 
/* 202 */       this.a);
/* 203 */     localLayoutParams.setMargins(this.a / 2, this.a, this.a / 2, this.a);
/* 204 */     localImageView.setLayoutParams(localLayoutParams);
/* 205 */     localImageView.setBackgroundDrawable(this.c);
/*     */ 
/* 207 */     this.d.add(localImageView);
/* 208 */     addView(localImageView);
/*     */   }
/*     */ 
/*     */   public void addPageCount(int paramInt) {
/* 212 */     this.e += paramInt;
/* 213 */     for (int i = 0; i < paramInt; i++)
/* 214 */       b();
/*     */   }
/*     */ 
/*     */   public int getPageCount()
/*     */   {
/* 224 */     return this.e;
/*     */   }
/*     */ 
/*     */   public void setCurrentPage(int paramInt)
/*     */   {
/* 234 */     if (paramInt < this.e) {
/* 235 */       ((ImageView)this.d.get(this.f)).setBackgroundDrawable(this.c);
/* 236 */       ((ImageView)this.d.get(paramInt)).setBackgroundDrawable(this.b);
/* 237 */       this.f = paramInt;
/*     */     }
/*     */   }
/*     */ 
/*     */   public int getCurrentPage()
/*     */   {
/* 247 */     return this.f;
/*     */   }
/*     */ 
/*     */   public void setIndicatorSize(int paramInt)
/*     */   {
/* 257 */     this.a = paramInt;
/* 258 */     for (int i = 0; i < this.e; i++)
/* 259 */       ((ImageView)this.d.get(i)).setLayoutParams(new LinearLayout.LayoutParams(this.a, this.a));
/*     */   }
/*     */ 
/*     */   public int getIndicatorSize()
/*     */   {
/* 269 */     return this.a;
/*     */   }
/*     */ 
/*     */   public void setOnPageControlClickListener(a parama)
/*     */   {
/* 301 */     this.h = parama;
/*     */   }
/*     */ 
/*     */   public a getOnPageControlClickListener()
/*     */   {
/* 312 */     return this.h;
/*     */   }
/*     */ 
/*     */   public static abstract interface a
/*     */   {
/*     */     public abstract void a();
/*     */ 
/*     */     public abstract void b();
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\umeng_sdk.jar
 * Qualified Name:     com.umeng.newxp.view.widget.SwipeViewPointer
 * JD-Core Version:    0.6.2
 */